import request from '@/utils/request';

/**
 * 获取登录验证码
 * @returns {*}
 */
export function getCode() {
  // return request.get('/admin-service/code')
  return request({
    url: '/admin-service/code',
    method: 'get',
    params: {},
  });
}

/**
 * 用户登录
 * @param userName
 * @param password
 * @param code
 * @param key
 * @returns {*}
 */
export function login({ userName, password, code, key }) {
  // return request.post('/admin-service/login', {userName, password, code, key})
  return request({
    url: '/admin-service/login',
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
    },
    data: { userName, password, code, key },
  });
}

/**
 * 获取登录用户信息
 * @returns {*}
 */
export function getUserInfo() {
  return request.get('/user/info');
}
